package com.fengmi.stat;

import com.fengmi.service.OrderStatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Author: 施俊豪
 * Date: 2022/2/8 14:32
 * Note: 订单定时任务
 */
@Component
public class OrderJob {

    @Autowired
    private OrderStatService orderStatService;
//    @Test
//    /**
//     *  cron = *(秒) *(分) *(时) *(天) *(月) ?(星期)
//     */
//    @Scheduled(cron = "* * * * * ?")
//    public void test1(){
//        System.out.println("hello");
//    }

    /**
     * @Note : 每日凌晨一点统计前一天的订单情况
     * @Date : 2022-02-08 14:46:59
     * @Author : 清酒吖
    */
    @Scheduled(cron = "0 0 1 * * ?")
    public void statOrderPerDay(){
        orderStatService.statOrderByDay();
    }
}
